--- /dev/null
+Author: Gert Wollny <gewo@debian.org>
+Description: work around numerical instability by rounding the time in seconds
+ to the six decimal points supported in dicom
+Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859204
+
+--- a/ofstd/libsrc/oftime.cc
++++ b/ofstd/libsrc/oftime.cc
+@@ -491,6 +491,10 @@
+ {
+ /* compute number of seconds since 00:00:00 */
+ double result = ((OFstatic_cast(double, hour) - timeZone) * 60 + OFstatic_cast(double, minute)) * 60 + second;
++
++ /* Dicom supports only six decimal digits, but floating point operations might introduce errors */
++ result = round(result * 1000000.0) / 1000000.0;
++
+ /* normalize the result to the range [0.0,86400.0[ */
+ if (normalize)
+ result -= OFstatic_cast(double, OFstatic_cast(unsigned long, result / 86400) * 86400);